Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

omit-empty

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

omit-empty

Recursively omit empty properties from an object. Omits empty objects, arrays, strings or zero.

  • 0.3.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
116K
increased by20.61%
Maintainers
1
Weekly downloads
 
Created
Source

omit-empty NPM version NPM downloads Build Status

Recursively omit empty properties from an object. Omits empty objects, arrays, strings or zero.

Install

Install with npm:

$ npm install omit-empty --save

Usage

var omitEmpty = require('omit-empty');

omitEmpty({a: 'a', b: ''});
//=> {a: 'a'}

omitEmpty({a: 'a', b: {c: 'c', d: ''}});
//=> {a: 'a', b: {c: 'c'}

omitEmpty({a: ['a'], b: []});
//=> {a: ['a']}

omitEmpty({a: 0, b: 1});
//=> {a: 0, b: 1}

// set the `noZero` flag
omitEmpty({a: 0, b: 1}, true);
//=> {b: 1}

You might also be interested in these projects:

  • for-in: Iterate over the own and inherited enumerable properties of an objecte, and return an object… more | homepage
  • for-own: Iterate over the own enumerable properties of an object, and return an object with properties… more | homepage
  • is-plain-object: Returns true if an object was created by the Object constructor. | homepage
  • reduce-object: Reduces an object to a value that is the accumulated result of running each property… more | homepage

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

Generate readme and API documentation with verb:

$ npm install verb && npm run docs

Or, if verb is installed globally:

$ verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016, Jon Schlinkert. Released under the MIT license.


This file was generated by verb, v0.9.0, on April 09, 2016.

Keywords

FAQs

Package last updated on 09 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc